package com.atguigu.gulimall.gulimallproduct.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Configuration
@EnableTransactionManagement
@MapperScan("com.atguigu.gulimall.gulimallproduct.dao")
public class MybatisPlusConfig {
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        // 填入某个较大的页码，true为返回第一页，false为继续操作
        paginationInterceptor.setOverflow(true);
        // 单页最大数据量
        paginationInterceptor.setLimit(1000);
        return paginationInterceptor;
    }

}
